package com.cgtu.cgtucalculator.util;

public class SpecialNum {
    public static final double PI=Math.PI;
    public static final double E=Math.E;

    public static double getNum(String str){
        switch (str){
            case "PI":
                return PI;
            case "E":
            case "e":
                return E;
            default:
                return 0.0;

        }
    }
    /*
    * 计算阶乘
    * */
    public static Double getJieChen(Double num) throws Exception {
        if(num>100) throw new Exception("阶乘结果过大暂不计算！");
        double num1=1.0;
        for (int i=2;i<=num;i++){
            num1*=i;
        }
        return num1;
    }
}
